//Granify Android SDK/com.granifyinc.granifysdk/Granify/registerGroupAssignmentProvider

registerGroupAssignmentProvider

[androidJvm]\

@JvmStatic

fun registerGroupAssignmentProvider(provider: () -> MatchingGroup)

Register a callback provider for specifying group assignments when a new session is created.

In most cases, Granify controls matching group assignments, but arrangements can be made with Granify to control group assignments via this callback instead; thereby manually controlling the group split or delegating it to another provider. Permitted group values for your site may be a subset of those in the MatchingGroup enumeration, so work with your Account Manager to determine how to use this function for your specific needs.

Expect your provider callback to be invoked by Granify any time a request is made that may result in a new session. This will happen after the first trackPageView request is made and at arbitrary later points when starting a new session after expiry.

Note that an invocation of this callback does not necessarily indicate that a new session will start. In some cases, the SDK may expect the session to be expired even though it is still active on the server. For example, rebooting the application will clear all local state causing the SDK to assume a new session is needed (thereby invoking this callback) even though the server can recover the existing session for the shopper. Use subscribeGroupAssigned for reliable notification of group assignments for new sessions.

Expect your provider callback to be invoked by Granify at any time when active. No guarantees are made regarding the thread the provider will be invoked on.

Placement

When in use, this function must be called prior to activateGranify on application launch.

Parameters

androidJvm

   
provider The callback function that provides the MatchingGroup for the session being initialized